package com.testfileupload.uploadimg.design.combination;

import java.util.ArrayList;

public class Root implements IRoot {
    //保存根节点下的树枝节点或者叶子节点
    private ArrayList subordinateList = new ArrayList();
    //根节点的名称
    private String name = "";
    //根节点的职位
    private String position = "";
    //根节点的薪水
    private int salory = 0;

    public Root(String name, String position, int salory) {
        this.name = name;
        this.position = position;
        this.salory = salory;
    }

    @Override
    public String getInfo() {
        String info = "";
        info = "名称：" + this.name;
        info = info + "职位" + this.position;
        info = info + "薪水" + this.salory;
        return info;
    }

    @Override
    public void add(IBranch branch) {
        this.subordinateList.add(branch);
    }

    @Override
    public void add(ILeaf leaf) {
        this.subordinateList.add(leaf);
    }

    @Override
    public ArrayList getSubordinateInfo() {

        return this.subordinateList;
    }
}
